<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户中心</title>
    <style>
        img{
            width:50px;
            height: 50px;
        }
    </style>
</head>
<body>
<a href="/index.php/index/add">新增专家</a>
<form action="/index.php/index/delete" METHOD="post">
    <table border="1" cellspacing="0" cellpadding="10px">
        <tr>
            <th><input type="checkbox" onchange="doSelect(event)"></th>
            <th>专家ID</th>
            <th>姓名</th>
            <th>性别</th>
            <th>科室</th>
            <th>职位</th>
            <th>照片</th>
            <th>添加时间</th>
            <th>操作</th>
        </tr>
        <?php foreach ($list as $doctor){ ?>
            <tr>
                <td><input type="checkbox" name="doctor_ids[]" class="doctor_ids" VALUE="<?= $doctor['id']?>"></td>
                <td><?= $doctor['id']?></td>
                <td><?= $doctor['name']?></td>
                <td><?= $doctor['sex']?></td>
                <td><?= $doctor['office']?></td>
                <td><?= $doctor['job']?></td>
                <td><img src="/image/<?= $doctor['image']?>"></td>
                <td><?= date('Y-m-d H:i:s',$doctor['create_time'])?></td>
                <td><a href="/index.php/index/edit?id=<?= $doctor['id']?>">编辑</a>&nbsp; <a href="#">删除</a></td>
            </tr>
        <?php } ?>
    </table>
        <button type="submit">删除选中</button>
</form>
</body>
<script>
    function doSelect(event) {
        var select = event.target.checked;
        var doctor_ids = document.getElementsByClassName('doctor_ids');
        for(var i=0;i<doctor_ids.length;i++){
            doctor_ids[i].checked = select;
        }
    }
</script>
</html>
